import {createRouter, createWebHashHistory, RouteRecordRaw} from "vue-router";
import {App} from "vue";
import {Layout} from "@/utils/routerHelper.ts";

const constantRouterMap: RouteRecordRaw[] = [
    {
        path: '/',
        component: Layout,
        name: 'Root',
        redirect: '/home',
        children: [
            {
                name: 'Home',
                component: () => import('@/views/Home/index.vue'),
                path: 'home'
            }
        ],
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    strict: true,
    routes: constantRouterMap as RouteRecordRaw[],
    scrollBehavior: () => ({ left: 0, top: 0 })
})

export const setupRouter = (app: App<Element>) => {
    app.use(router)
}

export default router;
